package com.ocean.controller.edu;

import com.ocean.dto.GCourseListDto;
import com.ocean.entity.edu.Course;
import com.ocean.service.edu.CourseService;
import com.ocean.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xk
 * @version 1.0
 */
@RestController
@RequestMapping("/api/edu/course/")
public class CourseController {
    @Autowired
    private CourseService service;

    @PostMapping("save.do")
    public R save(@RequestBody Course course) {
        return service.save(course);
    }

    @PostMapping("update.do")
    public R update(@RequestBody Course course) {
        return service.update(course);
    }

    @GetMapping("del.do")
    public R delete(int id) {
        return service.delete(id);
    }

    @GetMapping("page.do")
    public R page(int page, int size) {
        return service.queryPage(page, size);
    }

    @GetMapping("pagewhere.do")
    public R page(GCourseListDto dto){
        return service.queryPageWhere(dto);
    }
}
